﻿using System;
using System.Linq.Expressions;
using ApiManage.Core.Repository.MongoDB;
using ApiManage.Models.MongoMappings.Sys;
using Autofac.Extras.DynamicProxy;
using MongoDB.Driver;
using Rhonin.Common.Components;
using Rhonin.Common.UnitOfWork.Transaction;

namespace ApiManage.Applications.Mongo.Sys.Impl
{
    [Component]
    [Intercept(typeof(TransactionInterceptor))]
    public class SysColumnService : ISysColumnService
    {
        private readonly ISysRepository<SysColumn> _sysColumnRepository;
        public SysColumnService(ISysRepository<SysColumn> sysColumnRepository)
        {
            _sysColumnRepository = sysColumnRepository;
        }


        public void Insert(SysColumn param)
        {
            _sysColumnRepository.InsertOne(param);
        }

        public void Update(Expression<Func<SysColumn, bool>> fitter, UpdateDefinition<SysColumn> updateDefinition)
        {
            _sysColumnRepository.Update(fitter, updateDefinition);
        }
        public void Delete(Expression<Func<SysColumn, bool>> fitter)
        {
            _sysColumnRepository.Delete(fitter);
        }
    }
}
